# coding: utf8


class Student:
    """学生类"""

    school_name = '东湖一中'

    def __init__(self, sno, name, age):
        self.sno = sno
        self.name = name
        self.age = age

    @classmethod
    def print_school(cls, head=''):
        print(head, cls.school_name)


class Courses:
    majors = ['Chinese', 'Math', 'Foreign_Language']
    optionals = ['physics', 'Chemical', 'Biology', 'Geography', 'History', 'Politics']

    @classmethod
    def select_optional_courses(cls, opts):
        return [cls.optionals[opt] for opt in opts]


class JuniorStudent(Student, Courses):
    
    def __init__(self, sno, name, age):
        super().__init__(sno, name, age)
        self.courses = self.majors + self.optionals
    
    def print_student(self):
        print(self.sno, self.name, self.age, self.courses)


class HighStudent(JuniorStudent, Courses):

    def __init__(self, sno, name, age, opts):
        Student.__init__(self, sno, name, age)
        self.opt_courses = self.select_optional_courses(opts)
        self.courses = self.majors + self.opt_courses


def test_class_student():
    st1 = Student(1001, "李名", 21)
    st2 = Student(1002, "张一", 20)
    print(st1.sno, st1.name, st1.age)
    print(st2.sno, st2.name, st2.age)
    print(st1.school_name, st2.school_name)
    Student.school_name = '明天中学'
    print(st1.school_name, st2.school_name)
    st1.age = 23
    print(st1.age, st2.age)
    Student.print_school('学校：')


if __name__ == '__main__':
    test_class_student()

    # jst = JuniorStudent(1001, '李城', 14)
    # jst.print_student()
    # jst.print_school()
    # print(JuniorStudent.__mro__)
    #
    # hst = HighStudent(2001, '张迪', 15, (0, 2, 4))
    # hst.print_student()
    # hst.print_school()
    # print(HighStudent.__mro__)
